// 导入 express 模块
const express = require("express");

// 创建对象
const app = express();

app.get("/request", (req, res) => {
  // 原生操作
  console.log(req.method);
  console.log(req.url);
  console.log(req.httpVersion);
  console.log(req.headers);
  // express 操作
  console.log(req.path);
  console.log(req.query);
  console.log(req.ip);
  // 获取请求头
  console.log(req.get("host"));
  res.end("express get para");
});

app.listen(4000, () => {
  console.log("express框架--获取请求参数");
});
